#!/bin/bash
echo "3. Step T3 Fiber Tracking"

GLOBAL="/opt/dsi-studio/atlas/ICBM152/ICBM152.tt.gz.txt"
while IFS= read -r line
do
    TRACK_ID=$line

    for FILE in /data/fib/*.fib.gz; 
    do 
        echo "TRACK: $TRACK_ID, source=$FILE, output=/data/trk/$TRACK_ID.trk.gz" ; 
        dsi_studio --action=trk --source=$FILE --track_id=$TRACK_ID --output="/data/trk/$TRACK_ID.trk.gz" > /data/logs/3.trk.log 
    done
done < "$GLOBAL"